Class world

world contains functions which can query or alter the state of the game world.

Functions are available to create or list entities, get or set campaign variables, get the current game time, or write to the combat log. The class is accessed from a global object named "world".

Game state functions

world:GetTime () GetTime returns the current time for the game world.
world:GetMissionVar (key) GetMissionVar gets the current value of a mission variable.
world:GetCampaignVar (key) GetCampaignVar gets the current value of a campaign variable.
world:SetMissionVar (key, value) SetMissionVar sets a new value for a mission variable.
world:SetCampaignVar (key, value) SetCampaignVar sets a new value for a campaign variable.

Entity functions

world:GetPlayer () GetPlayer retrieves the main character entity.
world:GetSquad () GetSquad retrieves all characters and vehicles belonging to the player's squad.
world:GetAllEntitites () GetAllEntities retrieves all entities existing on the current map.
world:GetEntitiesByTag (tagname) GetEntitiesByTag retrieves all entities existing on the current map which have the given value as the tag name.
world:CreateEntity (entityFile, quantity) CreateEntity creates a new entity.

UI functions

world:CombatLog (level, str) CobatLog adds a string to the combat log.


Game state functions

Functions which get or set overall game state.
world:GetTime ()
GetTime returns the current time for the game world. The time value comes from the game millisecond timer, converted into year/month/day hour:minute:second.

Returns:

    A table formatted as a TimeStamp value, containing the current world time.
world:GetMissionVar (key)
GetMissionVar gets the current value of a mission variable.

Parameters:

  • key The key (name) of the mission variable to retrieve.

Returns:

    The value of the mission variable's value as a string. If the variable does not exist, returns an empty string.
world:GetCampaignVar (key)
GetCampaignVar gets the current value of a campaign variable.

Parameters:

  • key The key (name) of the campaign variable to retrieve.

Returns:

    The value of the campaign variable's value as a string. If the variable does not exist, returns an empty string.
world:SetMissionVar (key, value)
SetMissionVar sets a new value for a mission variable.

Parameters:

  • key The key (name) of the mission variable to set.
  • value The new value for the mission variable. If it does not exist, the variable will be created.

Returns:

    None.
world:SetCampaignVar (key, value)
SetCampaignVar sets a new value for a campaign variable.

Parameters:

  • key The key (name) of the campaign variable to set.
  • value The new value for the campaign variable. If it does not exist, the variable will be created.

Returns:

    None.

Entity functions

Functions which get or create entities.
world:GetPlayer ()
GetPlayer retrieves the main character entity.

Returns:

    An Entity object corresponding to the main character. Should be of type Actor.
world:GetSquad ()
GetSquad retrieves all characters and vehicles belonging to the player's squad.

Returns:

    An array of Entity objects corresponding to the squad members. Should be of types Actor or Vehicle.
world:GetAllEntitites ()
GetAllEntities retrieves all entities existing on the current map.

Returns:

    An array of Entity objects corresponding to all mission entities.
world:GetEntitiesByTag (tagname)
GetEntitiesByTag retrieves all entities existing on the current map which have the given value as the tag name.

Parameters:

  • tagname The tag name to search for in the entity list.

Returns:

    An array of Entity objects corresponding to all mission entities matching the given tag name.
world:CreateEntity (entityFile, quantity)
CreateEntity creates a new entity. At present, this only works for inventory items - subclasses of Collectable.

Parameters:

  • entityFile The file name of the entity to create.
  • quantity The number of that item to create.

Returns:

    An Entity object that can be passed to AddToInventory.

UI functions

UI and other miscellaneous functions.
world:CombatLog (level, str)
CobatLog adds a string to the combat log.

Parameters:

  • level The minimum logging level for this message to be displayed in the combat log. Can be COMBATLOGSYSTEM, COMBATLOGFEW, COMBATLOGDEFAULT, or COMBATLOGALL.
  • str The string to display in the combat log.
generated by LDoc 1.4.6 Last updated 2021-05-07 19:14:47